﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hm1_1
{
    public class Queue<T>
    {
        private static int Max = 10;
        T[] queue = new T[Max];
        private int queueTop = 0;
        private int queueBottom = 0;

        public void pushQueue(T i)
        {
            if (queueTop - queueBottom > Max-1) 
            {
                throw new Exception("超出队列大小上限");
            }
            else
            {
                queue[queueTop % Max] = i;
                queueTop++;
            }
        }

        public string popQueue()
        {
            
            if (queueBottom >= queueTop)
            {
                queueBottom = queueTop;
                throw new Exception("队列为空");
            }
            else
            {
                queueBottom++;
                return queue[(queueBottom-1)%Max].ToString();
            }    
        }
    }
}
